package parser;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;

public class Arquivo {
	InputStream lerArquivo(String filePath) throws IOException {
		String txt = null;
		BufferedReader in = new BufferedReader(new FileReader(filePath));
		String str = in.readLine();
		StringBuffer sb = new StringBuffer();
		while (str != null) {
			sb.append(str);
			sb.append("\n");
			str = in.readLine();
		}
		txt = sb.toString();
		in.close();

		ByteArrayOutputStream buffer = new ByteArrayOutputStream();
		buffer.write(txt.getBytes());
		InputStream is = new ByteArrayInputStream(buffer.toByteArray());
		return is;
	}
}
